{% extends 'ViettransFrontBundle::layout.html.twig' %}

{% block announcementId %}<script>var announcementId = {{ announcement.id }}</script>{% endblock %}

{% block breadscrumb %}
    {% render 'ViettransFrontBundle:Partial:breadScrumb' with {'request':app.request, 'announcement':announcement} %}
{% endblock %}

{% block body %}
<div class="clear"></div>
<div class="grid_19">
	<div id="announcement_show" class="panel_no_bordered">
		<div id="announcement" class="grid_13">
			<div class="title">{{ announcement.title }}</div>
	
			<div class="date_time">
				<div class="date">
					{% if announcement.validatedAt|date("m/d/Y") == "now"|date("m/d/Y") %}
						<b>Hôm nay</b>
					{% else %}
						<b>{{ announcement.validatedAt|date('d / m') }}</b>
					{% endif %}
				</div>
				
				<div class="time"> - <b>{{ announcement.validatedAt|date('H\\h i') }}</b></div>
				
				{% if announcement.userId %}
					<div class="user"><i> bởi</i><b> {{ announcement.contactName }}</b></div>
				{% endif %}
			</div>

			<div class="category_locality"><i>{{ announcement.categoryObj.name }} / {{ announcement.townObj.name }} ({{ announcement.townObj.code }})</i></div>
			
			<div class="photo">
				<img alt="photo" src="{{ asset(announcement.photos != '' ?'images/announcement/photo/' ~ announcement.photos ~ '.jpg' : 'images/announcement/thumb/noThumb80x60.jpg') }}" />
			</div>
			
			<div class="price">
				<i>Giá</i> <b>{{ announcement.price != '' ? announcement.price ~ ' €' : '-' }}</b>
			</div>

			<div class="description grid_18"><pre>{{announcement.description}}</pre></div>
		</div>
		
		<div id="contact_poster" class="grid_5 panel_bordered_dotted">
			<div class="overlay" id="overlay"></div>
			<div class="header">Liên hệ</div>
			<div id="contactInfos">
				<div><img src="{{ asset('images/iconUser.jpg') }}" /> {{ announcement.contactName }}</div>
				<div><img src="{{ asset('images/iconEmail.jpg') }}" /> {{ announcement.contactEmail }}</div>
				<div><img src="{{ asset('images/iconTelephone.jpg') }}" /> {{ announcement.contactTelephone | default('-') }}</div>
			</div>
			<form id="form_contact_poster">
				<p>
					<div class="label">{{form_label(form.clientName)}}</div>
					<div class="widget">{{form_widget(form.clientName)}}
						<div id="clientNameError" class="error"></div>
					</div>
				</p>
				<p>
					<div class="label">{{form_label(form.clientEmail)}}</div>
					<div class="widget">{{form_widget(form.clientEmail)}}
						<div id="clientEmailError" class="error"></div>
					</div>
				</p>
				<p>
					<div class="label">{{form_label(form.clientTelephone)}}</div>
					<div class="widget">{{form_widget(form.clientTelephone)}}
						<div class="note">*Không bắt buộc.</div>
						<div id="clientTelephoneError" class="error"></div>
					</div>
				</p>
				<p>
					<div class="label">{{form_label(form.clientMessage)}}</div>
					<div class="widget">{{form_widget(form.clientMessage)}}
						<div class="note">*Tối đa 500 kí tự.</div>
						<div id="clientMessageError" class="error"></div>
					</div>
				</p>
				<p>
					<div class="label">{{form_label(form.clientCaptcha)}} {{form_widget(form.clientCaptcha)}} {{ captcha.render | raw }}</div>
					<div id="clientCaptchaError" class="error"></div>
				</p>
				<p>
					<div class="error">{{form_errors(form)}}</div>
				</p>
				<p align="center">
					<button class="button email" type="submit">Gửi tin</button>
				</p>
			</form>
			<div align="center" id="sendErrorMessage"></div>
			<div align="center" id="expand"><img src="{{ asset('images/iconExpand.gif') }}" /></div>
		</div>
	</div>
</div>
{% endblock %}